package com.glorysoft.sunnypda.ui.eqpinfo

import android.os.Bundle
import androidx.databinding.ObservableArrayList
import com.glorysoft.sunnypda.R
import com.glorysoft.sunnypda.base.BaseViewModel
import com.glorysoft.sunnypda.entity.EqpInfoEntity
import com.glorysoft.sunnypda.entity.SupEqpEntity
import com.glorysoft.sunnypda.ui.eqpregister.EqpRegisterViewModel
import me.tatarka.bindingcollectionadapter2.BR
import me.tatarka.bindingcollectionadapter2.ItemBinding

/**
 * FileName: EqpInfoViewModel
 * Author: XJH
 * Date: 2022/3/21 17:47
 * Description:
 * History:
 */
class EqpInfoViewModel : BaseViewModel() {

    var eqpInfoEntity : EqpInfoEntity = EqpInfoEntity()


    val onClick : SupEqpFun = object : SupEqpFun {
        override fun onDelete(item: SupEqpEntity) {
            supEqpItems.remove(item)
        }

    }

    var supEqpItems = ObservableArrayList<SupEqpEntity>()
    var supEqpBinding =
        ItemBinding.of<SupEqpEntity>(BR.supEqpItem, R.layout.item_add_sup_eqp).bindExtra(BR.onSupDeleteClick,onClick)

    interface SupEqpFun{
        fun onDelete(item : SupEqpEntity)
    }
}